<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Module ra_server</title>
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="EDoc">
</head>
<body bgcolor="white">
<div class="navbar"><a name="#navbar_top"></a><table width="100%" border="0" cellspacing="0" cellpadding="2" summary="navigation bar"><tr><td><a href="overview-summary.html" target="overviewFrame">Overview</a></td><td><a href="http://www.erlang.org/"><img src="erlang.png" align="right" border="0" alt="erlang logo"></a></td></tr></table></div>
<hr>

<h1>Module ra_server</h1>
<ul class="index"><li><a href="#types">Data Types</a></li><li><a href="#index">Function Index</a></li><li><a href="#functions">Function Details</a></li></ul>


<h2><a name="types">Data Types</a></h2>

<h3 class="typedecl"><a name="type-command">command()</a></h3>
<p><pre>command() = 
    {<a href="#type-command_type">command_type()</a>,
     <a href="#type-command_meta">command_meta()</a>,
     UserCommand :: term(),
     <a href="#type-command_reply_mode">command_reply_mode()</a>} |
    {noop,
     <a href="#type-command_meta">command_meta()</a>,
     CurrentMachineVersion :: <a href="ra_machine.html#type-version">ra_machine:version()</a>}</pre></p>


<h3 class="typedecl"><a name="type-command_correlation">command_correlation()</a></h3>
<p><pre>command_correlation() = integer() | reference()</pre></p>


<h3 class="typedecl"><a name="type-command_meta">command_meta()</a></h3>
<p><pre>command_meta() = #{from =&gt; <a href="#type-from">from()</a>, ts := integer()}</pre></p>


<h3 class="typedecl"><a name="type-command_reply_mode">command_reply_mode()</a></h3>
<p><pre>command_reply_mode() = 
    after_log_append | await_consensus |
    {notify, <a href="#type-command_correlation">command_correlation()</a>, pid()} |
    noreply</pre></p>


<h3 class="typedecl"><a name="type-command_type">command_type()</a></h3>
<p><pre>command_type() = 
    '$usr' | '$ra_join' | '$ra_leave' | '$ra_cluster_change' |
    '$ra_cluster'</pre></p>


<h3 class="typedecl"><a name="type-config">config()</a></h3>
<p><pre>config() = <a href="#type-ra_server_config">ra_server_config()</a></pre></p>


<h3 class="typedecl"><a name="type-effect">effect()</a></h3>
<p><pre>effect() = 
    <a href="ra_machine.html#type-effect">ra_machine:effect()</a> |
    <a href="ra_log.html#type-effect">ra_log:effect()</a> |
    {reply, <a href="#type-ra_reply_body">ra_reply_body()</a>} |
    {reply, term(), <a href="#type-ra_reply_body">ra_reply_body()</a>} |
    {cast, <a href="#type-ra_server_id">ra_server_id()</a>, term()} |
    {send_vote_requests,
     [{<a href="#type-ra_server_id">ra_server_id()</a>, #request_vote_rpc{} | #pre_vote_rpc{}}]} |
    {send_rpc, <a href="#type-ra_server_id">ra_server_id()</a>, #append_entries_rpc{}} |
    {send_snapshot,
     To :: <a href="#type-ra_server_id">ra_server_id()</a>,
     {Module :: module(),
      Ref :: term(),
      LeaderId :: <a href="#type-ra_server_id">ra_server_id()</a>,
      Term :: <a href="#type-ra_term">ra_term()</a>}} |
    {next_event, <a href="#type-ra_msg">ra_msg()</a>} |
    {next_event, cast, <a href="#type-ra_msg">ra_msg()</a>} |
    {notify, pid(), reference()} |
    {record_leader_msg, <a href="#type-ra_server_id">ra_server_id()</a>} |
    start_election_timeout</pre></p>


<h3 class="typedecl"><a name="type-effects">effects()</a></h3>
<p><pre>effects() = [<a href="#type-effect">effect()</a>]</pre></p>


<h3 class="typedecl"><a name="type-machine_conf">machine_conf()</a></h3>
<p><pre>machine_conf() = 
    {module, module(), InitConfig :: map()} |
    {simple, <a href="#type-simple_apply_fun">simple_apply_fun</a>(term()), InitialState :: term()}</pre></p>
<p>  The machine configuration.
  This is how ra knows which module to use to invoke the ra_machine callbacks
  and the config to pass to the <a docgen-rel="seemfa" docgen-href="ra_machine#init/1" href="ra_machine.html#init-1"><code>ra_machine:init/1</code></a> implementation.
  The simple machine config is version that can only be used for simple state
  machines that cannot access any of the advanced features.</p>

<h3 class="typedecl"><a name="type-mutable_config">mutable_config()</a></h3>
<p><pre>mutable_config() = 
    #{cluster_name =&gt; <a href="#type-ra_cluster_name">ra_cluster_name()</a>,
      metrics_key =&gt; term(),
      broadcast_time =&gt; non_neg_integer(),
      tick_timeout =&gt; non_neg_integer(),
      await_condition_timeout =&gt; non_neg_integer(),
      max_pipeline_count =&gt; non_neg_integer(),
      ra_event_formatter =&gt; {module(), atom(), [term()]}}</pre></p>


<h3 class="typedecl"><a name="type-ra_await_condition_fun">ra_await_condition_fun()</a></h3>
<p><pre>ra_await_condition_fun() = 
    fun((<a href="#type-ra_msg">ra_msg()</a>, <a href="#type-ra_server_state">ra_server_state()</a>) -&gt;
            {boolean(), <a href="#type-ra_server_state">ra_server_state()</a>})</pre></p>


<h3 class="typedecl"><a name="type-ra_event_formatter_fun">ra_event_formatter_fun()</a></h3>
<p><pre>ra_event_formatter_fun() = 
    fun((<a href="#type-ra_server_id">ra_server_id()</a>, Evt :: term()) -&gt; term())</pre></p>


<h3 class="typedecl"><a name="type-ra_msg">ra_msg()</a></h3>
<p><pre>ra_msg() = 
    #append_entries_rpc{} |
    {<a href="#type-ra_server_id">ra_server_id()</a>, #append_entries_reply{}} |
    {<a href="#type-ra_server_id">ra_server_id()</a>, #install_snapshot_result{}} |
    #request_vote_rpc{} |
    #request_vote_result{} |
    #pre_vote_rpc{} |
    #pre_vote_result{} |
    #install_snapshot_rpc{} |
    election_timeout | await_condition_timeout |
    {command, <a href="#type-command">command()</a>} |
    {commands, [<a href="#type-command">command()</a>]} |
    <a href="ra_log.html#type-event">ra_log:event()</a> |
    {consistent_query, term(), <a href="ra.html#type-query_fun">ra:query_fun()</a>} |
    #heartbeat_rpc{} |
    {ra_server_id, #heartbeat_reply{}}</pre></p>


<h3 class="typedecl"><a name="type-ra_reply_body">ra_reply_body()</a></h3>
<p><pre>ra_reply_body() = 
    #append_entries_reply{} |
    #request_vote_result{} |
    #install_snapshot_result{} |
    #pre_vote_result{}</pre></p>


<h3 class="typedecl"><a name="type-ra_server_config">ra_server_config()</a></h3>
<p><pre>ra_server_config() = 
    #{id := <a href="#type-ra_server_id">ra_server_id()</a>,
      uid := <a href="#type-ra_uid">ra_uid()</a>,
      cluster_name := <a href="#type-ra_cluster_name">ra_cluster_name()</a>,
      log_init_args := <a href="ra_log.html#type-ra_log_init_args">ra_log:ra_log_init_args()</a>,
      initial_members := [<a href="#type-ra_server_id">ra_server_id()</a>],
      machine := <a href="#type-machine_conf">machine_conf()</a>,
      friendly_name =&gt; <a href="/Users/nkarl/code/rabbitmq/stdlib/doc/unicode.html#type-chardata">unicode:chardata()</a>,
      metrics_key =&gt; term(),
      broadcast_time =&gt; non_neg_integer(),
      tick_timeout =&gt; non_neg_integer(),
      await_condition_timeout =&gt; non_neg_integer(),
      max_pipeline_count =&gt; non_neg_integer(),
      ra_event_formatter =&gt; {module(), atom(), [term()]},
      counter =&gt; <a href="/Users/nkarl/code/rabbitmq/erts/doc/counters.html#type-counters_ref">counters:counters_ref()</a>,
      system_config =&gt; <a href="ra_system.html#type-config">ra_system:config()</a>}</pre></p>


<h3 class="typedecl"><a name="type-ra_server_state">ra_server_state()</a></h3>
<p><pre>ra_server_state() = 
    #{cfg := #cfg{},
      leader_id =&gt; <a href="#type-maybe">maybe</a>(<a href="#type-ra_server_id">ra_server_id()</a>),
      cluster := <a href="#type-ra_cluster">ra_cluster()</a>,
      cluster_change_permitted := boolean(),
      cluster_index_term := <a href="#type-ra_idxterm">ra_idxterm()</a>,
      previous_cluster =&gt; {<a href="#type-ra_index">ra_index()</a>, <a href="#type-ra_term">ra_term()</a>, <a href="#type-ra_cluster">ra_cluster()</a>},
      current_term := <a href="#type-ra_term">ra_term()</a>,
      log := term(),
      voted_for =&gt; <a href="#type-maybe">maybe</a>(<a href="#type-ra_server_id">ra_server_id()</a>),
      votes =&gt; non_neg_integer(),
      commit_index := <a href="#type-ra_index">ra_index()</a>,
      last_applied := <a href="#type-ra_index">ra_index()</a>,
      persisted_last_applied =&gt; <a href="#type-ra_index">ra_index()</a>,
      stop_after =&gt; <a href="#type-ra_index">ra_index()</a>,
      machine_state := term(),
      aux_state =&gt; term(),
      condition =&gt; <a href="#type-ra_await_condition_fun">ra_await_condition_fun()</a>,
      condition_timeout_changes =&gt;
          #{transition_to := <a href="#type-ra_state">ra_state()</a>, effects := [<a href="#type-effect">effect()</a>]},
      pre_vote_token =&gt; reference(),
      query_index := non_neg_integer(),
      queries_waiting_heartbeats :=
          <a href="/Users/nkarl/code/rabbitmq/stdlib/doc/queue.html#type-queue">queue:queue</a>({non_neg_integer(), <a href="#type-consistent_query_ref">consistent_query_ref()</a>}),
      pending_consistent_queries := [<a href="#type-consistent_query_ref">consistent_query_ref()</a>],
      commit_latency =&gt; <a href="#type-maybe">maybe</a>(non_neg_integer())}</pre></p>


<h3 class="typedecl"><a name="type-ra_state">ra_state()</a></h3>
<p><pre>ra_state() = 
    leader | follower | candidate | pre_vote | await_condition |
    delete_and_terminate | terminating_leader |
    terminating_follower | recover | recovered | stop |
    receive_snapshot</pre></p>


<h3 class="typedecl"><a name="type-simple_apply_fun">simple_apply_fun()</a></h3>
<p><pre>simple_apply_fun(State) = fun((term(), State) -&gt; State)</pre></p>


<h2><a name="index">Function Index</a></h2>
<table width="100%" border="1" cellspacing="0" cellpadding="2" summary="function index"><tr><td valign="top"><a href="#name-2">name/2</a></td><td></td></tr>
<tr><td valign="top"><a href="#init-1">init/1</a></td><td></td></tr>
<tr><td valign="top"><a href="#recover-1">recover/1</a></td><td></td></tr>
<tr><td valign="top"><a href="#handle_leader-2">handle_leader/2</a></td><td></td></tr>
<tr><td valign="top"><a href="#handle_candidate-2">handle_candidate/2</a></td><td></td></tr>
<tr><td valign="top"><a href="#handle_pre_vote-2">handle_pre_vote/2</a></td><td></td></tr>
<tr><td valign="top"><a href="#handle_follower-2">handle_follower/2</a></td><td></td></tr>
<tr><td valign="top"><a href="#handle_receive_snapshot-2">handle_receive_snapshot/2</a></td><td></td></tr>
<tr><td valign="top"><a href="#handle_await_condition-2">handle_await_condition/2</a></td><td></td></tr>
<tr><td valign="top"><a href="#process_new_leader_queries-1">process_new_leader_queries/1</a></td><td></td></tr>
<tr><td valign="top"><a href="#tick-1">tick/1</a></td><td></td></tr>
<tr><td valign="top"><a href="#handle_state_enter-2">handle_state_enter/2</a></td><td></td></tr>
<tr><td valign="top"><a href="#overview-1">overview/1</a></td><td></td></tr>
<tr><td valign="top"><a href="#metrics-1">metrics/1</a></td><td></td></tr>
<tr><td valign="top"><a href="#is_new-1">is_new/1</a></td><td></td></tr>
<tr><td valign="top"><a href="#is_fully_persisted-1">is_fully_persisted/1</a></td><td></td></tr>
<tr><td valign="top"><a href="#is_fully_replicated-1">is_fully_replicated/1</a></td><td></td></tr>
<tr><td valign="top"><a href="#handle_aux-4">handle_aux/4</a></td><td></td></tr>
<tr><td valign="top"><a href="#id-1">id/1</a></td><td></td></tr>
<tr><td valign="top"><a href="#log_id-1">log_id/1</a></td><td></td></tr>
<tr><td valign="top"><a href="#uid-1">uid/1</a></td><td></td></tr>
<tr><td valign="top"><a href="#system_config-1">system_config/1</a></td><td></td></tr>
<tr><td valign="top"><a href="#leader_id-1">leader_id/1</a></td><td></td></tr>
<tr><td valign="top"><a href="#current_term-1">current_term/1</a></td><td></td></tr>
<tr><td valign="top"><a href="#machine_version-1">machine_version/1</a></td><td></td></tr>
<tr><td valign="top"><a href="#machine_query-2">machine_query/2</a></td><td></td></tr>
<tr><td valign="top"><a href="#make_rpcs-1">make_rpcs/1</a></td><td></td></tr>
<tr><td valign="top"><a href="#update_release_cursor-3">update_release_cursor/3</a></td><td></td></tr>
<tr><td valign="top"><a href="#persist_last_applied-1">persist_last_applied/1</a></td><td></td></tr>
<tr><td valign="top"><a href="#update_peer-3">update_peer/3</a></td><td></td></tr>
<tr><td valign="top"><a href="#register_external_log_reader-2">register_external_log_reader/2</a></td><td></td></tr>
<tr><td valign="top"><a href="#handle_down-5">handle_down/5</a></td><td></td></tr>
<tr><td valign="top"><a href="#handle_node_status-6">handle_node_status/6</a></td><td></td></tr>
<tr><td valign="top"><a href="#terminate-2">terminate/2</a></td><td></td></tr>
<tr><td valign="top"><a href="#log_fold-3">log_fold/3</a></td><td></td></tr>
<tr><td valign="top"><a href="#read_at-2">read_at/2</a></td><td></td></tr>
</table>

<h2><a name="functions">Function Details</a></h2>

<h3 class="function"><a name="name-2">name/2</a></h3>
<div class="spec">
<p><pre>name(ClusterName :: <a href="#type-ra_cluster_name">ra_cluster_name()</a>, UniqueSuffix :: string()) -&gt;
        atom()</pre></p>
<p> </p>
</div>

<h3 class="function"><a name="init-1">init/1</a></h3>
<div class="spec">
<p><pre>init(Config :: <a href="#type-ra_server_config">ra_server_config()</a>) -&gt; <a href="#type-ra_server_state">ra_server_state()</a></pre></p>
<p> </p>
</div>

<h3 class="function"><a name="recover-1">recover/1</a></h3>
<div class="spec">
<p><tt>recover(State0) -&gt; any()</tt></p>
<p> </p>
</div>

<h3 class="function"><a name="handle_leader-2">handle_leader/2</a></h3>
<div class="spec">
<p><pre>handle_leader(Install_snapshot_rpc :: <a href="#type-ra_msg">ra_msg()</a>,
              State0 :: <a href="#type-ra_server_state">ra_server_state()</a>) -&gt;
                 {<a href="#type-ra_state">ra_state()</a>, <a href="#type-ra_server_state">ra_server_state()</a>, <a href="#type-effects">effects()</a>}</pre></p>
<p> </p>
</div>

<h3 class="function"><a name="handle_candidate-2">handle_candidate/2</a></h3>
<div class="spec">
<p><pre>handle_candidate(Request_vote_result ::
                     <a href="#type-ra_msg">ra_msg()</a> | election_timeout,
                 State0 :: <a href="#type-ra_server_state">ra_server_state()</a>) -&gt;
                    {<a href="#type-ra_state">ra_state()</a>, <a href="#type-ra_server_state">ra_server_state()</a>, <a href="#type-effects">effects()</a>}</pre></p>
<p> </p>
</div>

<h3 class="function"><a name="handle_pre_vote-2">handle_pre_vote/2</a></h3>
<div class="spec">
<p><pre>handle_pre_vote(Append_entries_rpc :: <a href="#type-ra_msg">ra_msg()</a>,
                State0 :: <a href="#type-ra_server_state">ra_server_state()</a>) -&gt;
                   {<a href="#type-ra_state">ra_state()</a>, <a href="#type-ra_server_state">ra_server_state()</a>, <a href="#type-effects">effects()</a>}</pre></p>
<p> </p>
</div>

<h3 class="function"><a name="handle_follower-2">handle_follower/2</a></h3>
<div class="spec">
<p><pre>handle_follower(Append_entries_rpc :: <a href="#type-ra_msg">ra_msg()</a>,
                State00 :: <a href="#type-ra_server_state">ra_server_state()</a>) -&gt;
                   {<a href="#type-ra_state">ra_state()</a>, <a href="#type-ra_server_state">ra_server_state()</a>, <a href="#type-effects">effects()</a>}</pre></p>
<p> </p>
</div>

<h3 class="function"><a name="handle_receive_snapshot-2">handle_receive_snapshot/2</a></h3>
<div class="spec">
<p><tt>handle_receive_snapshot(Install_snapshot_rpc, State0) -&gt; any()</tt></p>
<p> </p>
</div>

<h3 class="function"><a name="handle_await_condition-2">handle_await_condition/2</a></h3>
<div class="spec">
<p><pre>handle_await_condition(Request_vote_rpc :: <a href="#type-ra_msg">ra_msg()</a>,
                       State :: <a href="#type-ra_server_state">ra_server_state()</a>) -&gt;
                          {<a href="#type-ra_state">ra_state()</a>,
                           <a href="#type-ra_server_state">ra_server_state()</a>,
                           <a href="#type-effects">effects()</a>}</pre></p>
<p> </p>
</div>

<h3 class="function"><a name="process_new_leader_queries-1">process_new_leader_queries/1</a></h3>
<div class="spec">
<p><pre>process_new_leader_queries(State0 :: <a href="#type-ra_server_state">ra_server_state()</a>) -&gt;
                              {<a href="#type-ra_server_state">ra_server_state()</a>, [<a href="#type-from">from()</a>]}</pre></p>
<p> </p>
</div>

<h3 class="function"><a name="tick-1">tick/1</a></h3>
<div class="spec">
<p><pre>tick(X1 :: <a href="#type-ra_server_state">ra_server_state()</a>) -&gt; <a href="#type-effects">effects()</a></pre></p>
<p> </p>
</div>

<h3 class="function"><a name="handle_state_enter-2">handle_state_enter/2</a></h3>
<div class="spec">
<p><pre>handle_state_enter(RaftState :: <a href="#type-ra_state">ra_state()</a> | eol,
                   State :: <a href="#type-ra_server_state">ra_server_state()</a>) -&gt;
                      {<a href="#type-ra_server_state">ra_server_state()</a> | eol, <a href="#type-effects">effects()</a>}</pre></p>
<p> </p>
</div>

<h3 class="function"><a name="overview-1">overview/1</a></h3>
<div class="spec">
<p><pre>overview(State :: <a href="#type-ra_server_state">ra_server_state()</a>) -&gt; map()</pre></p>
<p> </p>
</div>

<h3 class="function"><a name="metrics-1">metrics/1</a></h3>
<div class="spec">
<p><pre>metrics(State :: <a href="#type-ra_server_state">ra_server_state()</a>) -&gt;
           {atom(),
            <a href="#type-ra_term">ra_term()</a>,
            <a href="#type-ra_index">ra_index()</a>,
            <a href="#type-ra_index">ra_index()</a>,
            <a href="#type-ra_index">ra_index()</a>,
            <a href="#type-ra_index">ra_index()</a>,
            non_neg_integer()}</pre></p>
<p> </p>
</div>

<h3 class="function"><a name="is_new-1">is_new/1</a></h3>
<div class="spec">
<p><pre>is_new(X1 :: <a href="#type-ra_server_state">ra_server_state()</a>) -&gt; boolean()</pre></p>
<p> </p>
</div>

<h3 class="function"><a name="is_fully_persisted-1">is_fully_persisted/1</a></h3>
<div class="spec">
<p><pre>is_fully_persisted(X1 :: <a href="#type-ra_server_state">ra_server_state()</a>) -&gt; boolean()</pre></p>
<p> </p>
</div>

<h3 class="function"><a name="is_fully_replicated-1">is_fully_replicated/1</a></h3>
<div class="spec">
<p><pre>is_fully_replicated(State :: <a href="#type-ra_server_state">ra_server_state()</a>) -&gt; boolean()</pre></p>
<p> </p>
</div>

<h3 class="function"><a name="handle_aux-4">handle_aux/4</a></h3>
<div class="spec">
<p><tt>handle_aux(RaftState, Type, Cmd, State0) -&gt; any()</tt></p>
<p> </p>
</div>

<h3 class="function"><a name="id-1">id/1</a></h3>
<div class="spec">
<p><pre>id(X1 :: <a href="#type-ra_server_state">ra_server_state()</a>) -&gt; <a href="#type-ra_server_id">ra_server_id()</a></pre></p>
<p> </p>
</div>

<h3 class="function"><a name="log_id-1">log_id/1</a></h3>
<div class="spec">
<p><pre>log_id(X1 :: <a href="#type-ra_server_state">ra_server_state()</a>) -&gt; <a href="/Users/nkarl/code/rabbitmq/stdlib/doc/unicode.html#type-chardata">unicode:chardata()</a></pre></p>
<p> </p>
</div>

<h3 class="function"><a name="uid-1">uid/1</a></h3>
<div class="spec">
<p><pre>uid(X1 :: <a href="#type-ra_server_state">ra_server_state()</a>) -&gt; <a href="#type-ra_uid">ra_uid()</a></pre></p>
<p> </p>
</div>

<h3 class="function"><a name="system_config-1">system_config/1</a></h3>
<div class="spec">
<p><pre>system_config(X1 :: <a href="#type-ra_server_state">ra_server_state()</a>) -&gt; <a href="ra_system.html#type-config">ra_system:config()</a></pre></p>
<p> </p>
</div>

<h3 class="function"><a name="leader_id-1">leader_id/1</a></h3>
<div class="spec">
<p><pre>leader_id(State :: <a href="#type-ra_server_state">ra_server_state()</a>) -&gt; <a href="#type-maybe">maybe</a>(<a href="#type-ra_server_id">ra_server_id()</a>)</pre></p>
<p> </p>
</div>

<h3 class="function"><a name="current_term-1">current_term/1</a></h3>
<div class="spec">
<p><pre>current_term(State :: <a href="#type-ra_server_state">ra_server_state()</a>) -&gt; <a href="#type-maybe">maybe</a>(<a href="#type-ra_term">ra_term()</a>)</pre></p>
<p> </p>
</div>

<h3 class="function"><a name="machine_version-1">machine_version/1</a></h3>
<div class="spec">
<p><pre>machine_version(X1 :: <a href="#type-ra_server_state">ra_server_state()</a>) -&gt; non_neg_integer()</pre></p>
<p> </p>
</div>

<h3 class="function"><a name="machine_query-2">machine_query/2</a></h3>
<div class="spec">
<p><pre>machine_query(QueryFun :: fun((term()) -&gt; term()),
              X2 :: <a href="#type-ra_server_state">ra_server_state()</a>) -&gt;
                 {<a href="#type-ra_idxterm">ra_idxterm()</a>, term()}</pre></p>
<p> </p>
</div>

<h3 class="function"><a name="make_rpcs-1">make_rpcs/1</a></h3>
<div class="spec">
<p><tt>make_rpcs(State) -&gt; any()</tt></p>
<p> </p>
</div>

<h3 class="function"><a name="update_release_cursor-3">update_release_cursor/3</a></h3>
<div class="spec">
<p><pre>update_release_cursor(Index :: <a href="#type-ra_index">ra_index()</a>,
                      MacState :: term(),
                      State :: <a href="#type-ra_server_state">ra_server_state()</a>) -&gt;
                         {<a href="#type-ra_server_state">ra_server_state()</a>, <a href="#type-effects">effects()</a>}</pre></p>
<p> </p>
</div>

<h3 class="function"><a name="persist_last_applied-1">persist_last_applied/1</a></h3>
<div class="spec">
<p><pre>persist_last_applied(State :: <a href="#type-ra_server_state">ra_server_state()</a>) -&gt;
                        <a href="#type-ra_server_state">ra_server_state()</a></pre></p>
<p> </p>
</div>

<h3 class="function"><a name="update_peer-3">update_peer/3</a></h3>
<div class="spec">
<p><pre>update_peer(PeerId :: <a href="#type-ra_server_id">ra_server_id()</a>,
            Update ::
                #{next_index =&gt; non_neg_integer(),
                  query_index =&gt; non_neg_integer(),
                  commit_index_sent =&gt; non_neg_integer(),
                  status =&gt; <a href="#type-ra_peer_status">ra_peer_status()</a>},
            State :: <a href="#type-ra_server_state">ra_server_state()</a>) -&gt;
               <a href="#type-ra_server_state">ra_server_state()</a></pre></p>
<p> </p>
</div>

<h3 class="function"><a name="register_external_log_reader-2">register_external_log_reader/2</a></h3>
<div class="spec">
<p><pre>register_external_log_reader(Pid :: pid(),
                             State :: <a href="#type-ra_server_state">ra_server_state()</a>) -&gt;
                                {<a href="#type-ra_server_state">ra_server_state()</a>, <a href="#type-effects">effects()</a>}</pre></p>
<p> </p>
</div>

<h3 class="function"><a name="handle_down-5">handle_down/5</a></h3>
<div class="spec">
<p><pre>handle_down(RaftState :: <a href="#type-ra_state">ra_state()</a>,
            Type ::
                machine | snapshot_sender | snapshot_writer | aux,
            Pid :: pid(),
            Info :: term(),
            State :: <a href="#type-ra_server_state">ra_server_state()</a>) -&gt;
               {<a href="#type-ra_state">ra_state()</a>, <a href="#type-ra_server_state">ra_server_state()</a>, <a href="#type-effects">effects()</a>}</pre></p>
<p> </p>
</div>

<h3 class="function"><a name="handle_node_status-6">handle_node_status/6</a></h3>
<div class="spec">
<p><pre>handle_node_status(RaftState :: <a href="#type-ra_state">ra_state()</a>,
                   Type :: machine | aux,
                   Node :: node(),
                   Status :: nodeup | nodedown,
                   Infos :: term(),
                   State :: <a href="#type-ra_server_state">ra_server_state()</a>) -&gt;
                      {<a href="#type-ra_state">ra_state()</a>, <a href="#type-ra_server_state">ra_server_state()</a>, <a href="#type-effects">effects()</a>}</pre></p>
<p> </p>
</div>

<h3 class="function"><a name="terminate-2">terminate/2</a></h3>
<div class="spec">
<p><pre>terminate(State :: <a href="#type-ra_server_state">ra_server_state()</a>,
          Reason :: {shutdown, delete} | term()) -&gt;
             ok</pre></p>
<p> </p>
</div>

<h3 class="function"><a name="log_fold-3">log_fold/3</a></h3>
<div class="spec">
<p><pre>log_fold(RaState :: <a href="#type-ra_server_state">ra_server_state()</a>,
         Fun :: fun((term(), State) -&gt; State),
         State) -&gt;
            {ok, State, <a href="#type-ra_server_state">ra_server_state()</a>} |
            {error, term(), <a href="#type-ra_server_state">ra_server_state()</a>}</pre></p>
<p> </p>
</div>

<h3 class="function"><a name="read_at-2">read_at/2</a></h3>
<div class="spec">
<p><pre>read_at(Idx :: <a href="#type-ra_index">ra_index()</a>, RaState :: <a href="#type-ra_server_state">ra_server_state()</a>) -&gt;
           {ok, term(), <a href="#type-ra_server_state">ra_server_state()</a>} |
           {error, <a href="#type-ra_server_state">ra_server_state()</a>}</pre></p>
<p> </p>
</div>
<hr>

<div class="navbar"><a name="#navbar_bottom"></a><table width="100%" border="0" cellspacing="0" cellpadding="2" summary="navigation bar"><tr><td><a href="overview-summary.html" target="overviewFrame">Overview</a></td><td><a href="http://www.erlang.org/"><img src="erlang.png" align="right" border="0" alt="erlang logo"></a></td></tr></table></div>
<p><i>Generated by EDoc</i></p>
</body>
</html>
